<!-- -->
<template>
  <div class='countdown'>
    <span>获取验证码({{ time }}s)</span>
  </div>
</template>

<script setup lang='ts'>
import { ref, reactive } from 'vue'
import { useUserStore } from '@/stores/user'
let userStore = useUserStore()

let emit = defineEmits(['getFlag'])

let time = ref<number>(60)

let timer = setInterval(() => {
  time.value--
  if (time.value === 0 || !userStore.dialogVisible) {
    timer && clearInterval(timer)
    emit('getFlag', false)
  }
}, 1000)



</script>

<style lang='scss' scoped>

</style>
